---@class Table_EffectItem
local Table_EffectItem = BaseClass("Table_EffectItem", IDataItem)

function Table_EffectItem:__ctor()
	---@type number @唯一ID
	self.Id = 0
	---@type string @Prefab路径或ModelID
	self.Path = ""
	---@type number @特效延迟时间
	self.DelayTime = 0
	---@type boolean @是否播放完只失效(0销毁，1不销毁只失效）
	self.IsOnlyDeactive = false
	---@type number[] @位置
	self.Pos = {}
	---@type number[] @旋转
	self.Rota = {}
	---@type number @持续时间 0代表循环
	self.Duration = 0
end

function Table_EffectItem:Load(reader)
	self.temp = reader:ReadShortString()
	self.Id = tonumber(self.temp)
	self.Path = reader:ReadString()
	self.temp = reader:ReadShortString()
	self.DelayTime = tonumber(self.temp)
	self.IsOnlyDeactive = reader:ReadBool()
	self.temp = reader:ReadShortString()
	self.Pos = Utility.StringToNumbers(self.temp)
	self.temp = reader:ReadShortString()
	self.Rota = Utility.StringToNumbers(self.temp)
	self.temp = reader:ReadShortString()
	self.Duration = tonumber(self.temp)
end

---@class Table_EffectMgr : IDataMgr
local this = BaseClass("Table_EffectMgr", IDataMgr)

function this:FileName()
	return "Txt/Effect.txt"
end

---@return Table_EffectItem
function this:GetItemByKey(key)
	return self.super.GetItemByKey(self, key)
end

---@return Table_EffectItem
function this:GetItemByIdx(idx)
	return self.super.GetItemByIdx(self, idx)
end

function this:Load(reader)
	local item = Table_EffectItem()
	item:Load(reader)
	self.mItemDic[item.Id] = self.mDataCount
	table.insert(self.mItemList, item)
end

---@type Table_EffectMgr
Table_EffectMgr = this()